package base;

public class IndexDemo {

    public static void main(String[] args) {
        int[] arr = new int[5];

        System.out.println("数组长度是：" + arr.length); //打印数组的长度
        arr[0] = 1;
        arr[arr.length - 1] = 100;
        System.out.println(arr[0]);
        System.out.println(arr[arr.length - 1]);
        arr[arr.length] = 1000; //这里出现ArrayIndexOutOfBoundsException
        System.out.println(arr[arr.length]);

    }
}
